using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace p4comtest
{
	/// <summary>
	/// Summary description for EnvForm.
	/// </summary>
	public class EnvForm : System.Windows.Forms.Form
	{
		public System.Windows.Forms.Button cmdUpdate;
		public System.Windows.Forms.TextBox txtUser;
		public System.Windows.Forms.TextBox txtPassword;
		public System.Windows.Forms.TextBox txtLanguage;
		public System.Windows.Forms.TextBox txtHost;
		public System.Windows.Forms.TextBox txtCwd;
		public System.Windows.Forms.TextBox txtCharset;
		public System.Windows.Forms.TextBox txtClient;
		public System.Windows.Forms.TextBox txtPort;
		public System.Windows.Forms.Button cmdClose;
		public System.Windows.Forms.Label _Label2_7;
		public System.Windows.Forms.Label _Label2_6;
		public System.Windows.Forms.Label _Label2_5;
		public System.Windows.Forms.Label _Label2_4;
		public System.Windows.Forms.Label _Label2_3;
		public System.Windows.Forms.Label _Label2_2;
		public System.Windows.Forms.Label _Label2_1;
		public System.Windows.Forms.Label _Label2_0;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public EnvForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.cmdUpdate = new System.Windows.Forms.Button();
			this.txtUser = new System.Windows.Forms.TextBox();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.txtLanguage = new System.Windows.Forms.TextBox();
			this.txtHost = new System.Windows.Forms.TextBox();
			this.txtCwd = new System.Windows.Forms.TextBox();
			this.txtCharset = new System.Windows.Forms.TextBox();
			this.txtClient = new System.Windows.Forms.TextBox();
			this.txtPort = new System.Windows.Forms.TextBox();
			this.cmdClose = new System.Windows.Forms.Button();
			this._Label2_7 = new System.Windows.Forms.Label();
			this._Label2_6 = new System.Windows.Forms.Label();
			this._Label2_5 = new System.Windows.Forms.Label();
			this._Label2_4 = new System.Windows.Forms.Label();
			this._Label2_3 = new System.Windows.Forms.Label();
			this._Label2_2 = new System.Windows.Forms.Label();
			this._Label2_1 = new System.Windows.Forms.Label();
			this._Label2_0 = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// cmdUpdate
			// 
			this.cmdUpdate.BackColor = System.Drawing.SystemColors.Control;
			this.cmdUpdate.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdUpdate.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdUpdate.Location = new System.Drawing.Point(180, 275);
			this.cmdUpdate.Name = "cmdUpdate";
			this.cmdUpdate.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdUpdate.Size = new System.Drawing.Size(97, 33);
			this.cmdUpdate.TabIndex = 35;
			this.cmdUpdate.Text = "&Update";
			this.cmdUpdate.Click += new System.EventHandler(this.cmdUpdate_Click);
			// 
			// txtUser
			// 
			this.txtUser.AcceptsReturn = true;
			this.txtUser.AutoSize = false;
			this.txtUser.BackColor = System.Drawing.SystemColors.Window;
			this.txtUser.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtUser.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtUser.Location = new System.Drawing.Point(116, 235);
			this.txtUser.MaxLength = 0;
			this.txtUser.Name = "txtUser";
			this.txtUser.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtUser.Size = new System.Drawing.Size(289, 25);
			this.txtUser.TabIndex = 27;
			this.txtUser.Text = "";
			// 
			// txtPassword
			// 
			this.txtPassword.AcceptsReturn = true;
			this.txtPassword.AutoSize = false;
			this.txtPassword.BackColor = System.Drawing.SystemColors.Window;
			this.txtPassword.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtPassword.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtPassword.Location = new System.Drawing.Point(116, 203);
			this.txtPassword.MaxLength = 0;
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtPassword.Size = new System.Drawing.Size(289, 25);
			this.txtPassword.TabIndex = 26;
			this.txtPassword.Text = "";
			// 
			// txtLanguage
			// 
			this.txtLanguage.AcceptsReturn = true;
			this.txtLanguage.AutoSize = false;
			this.txtLanguage.BackColor = System.Drawing.SystemColors.Window;
			this.txtLanguage.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtLanguage.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtLanguage.Location = new System.Drawing.Point(116, 171);
			this.txtLanguage.MaxLength = 0;
			this.txtLanguage.Name = "txtLanguage";
			this.txtLanguage.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtLanguage.Size = new System.Drawing.Size(289, 25);
			this.txtLanguage.TabIndex = 25;
			this.txtLanguage.Text = "";
			// 
			// txtHost
			// 
			this.txtHost.AcceptsReturn = true;
			this.txtHost.AutoSize = false;
			this.txtHost.BackColor = System.Drawing.SystemColors.Window;
			this.txtHost.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtHost.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtHost.Location = new System.Drawing.Point(116, 139);
			this.txtHost.MaxLength = 0;
			this.txtHost.Name = "txtHost";
			this.txtHost.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtHost.Size = new System.Drawing.Size(289, 25);
			this.txtHost.TabIndex = 24;
			this.txtHost.Text = "";
			// 
			// txtCwd
			// 
			this.txtCwd.AcceptsReturn = true;
			this.txtCwd.AutoSize = false;
			this.txtCwd.BackColor = System.Drawing.SystemColors.Window;
			this.txtCwd.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtCwd.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtCwd.Location = new System.Drawing.Point(116, 107);
			this.txtCwd.MaxLength = 0;
			this.txtCwd.Name = "txtCwd";
			this.txtCwd.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtCwd.Size = new System.Drawing.Size(289, 25);
			this.txtCwd.TabIndex = 23;
			this.txtCwd.Text = "";
			// 
			// txtCharset
			// 
			this.txtCharset.AcceptsReturn = true;
			this.txtCharset.AutoSize = false;
			this.txtCharset.BackColor = System.Drawing.SystemColors.Window;
			this.txtCharset.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtCharset.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtCharset.Location = new System.Drawing.Point(116, 75);
			this.txtCharset.MaxLength = 0;
			this.txtCharset.Name = "txtCharset";
			this.txtCharset.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtCharset.Size = new System.Drawing.Size(289, 25);
			this.txtCharset.TabIndex = 22;
			this.txtCharset.Text = "";
			// 
			// txtClient
			// 
			this.txtClient.AcceptsReturn = true;
			this.txtClient.AutoSize = false;
			this.txtClient.BackColor = System.Drawing.SystemColors.Window;
			this.txtClient.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtClient.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtClient.Location = new System.Drawing.Point(116, 43);
			this.txtClient.MaxLength = 0;
			this.txtClient.Name = "txtClient";
			this.txtClient.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtClient.Size = new System.Drawing.Size(289, 25);
			this.txtClient.TabIndex = 21;
			this.txtClient.Text = "";
			// 
			// txtPort
			// 
			this.txtPort.AcceptsReturn = true;
			this.txtPort.AutoSize = false;
			this.txtPort.BackColor = System.Drawing.SystemColors.Window;
			this.txtPort.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtPort.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtPort.Location = new System.Drawing.Point(116, 11);
			this.txtPort.MaxLength = 0;
			this.txtPort.Name = "txtPort";
			this.txtPort.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtPort.Size = new System.Drawing.Size(289, 25);
			this.txtPort.TabIndex = 19;
			this.txtPort.Text = "";
			// 
			// cmdClose
			// 
			this.cmdClose.BackColor = System.Drawing.SystemColors.Control;
			this.cmdClose.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cmdClose.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdClose.Location = new System.Drawing.Point(292, 275);
			this.cmdClose.Name = "cmdClose";
			this.cmdClose.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdClose.Size = new System.Drawing.Size(97, 33);
			this.cmdClose.TabIndex = 18;
			this.cmdClose.Text = "Close";
			this.cmdClose.Click += new System.EventHandler(this.cmdClose_Click);
			// 
			// _Label2_7
			// 
			this._Label2_7.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_7.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_7.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_7.Location = new System.Drawing.Point(44, 235);
			this._Label2_7.Name = "_Label2_7";
			this._Label2_7.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_7.Size = new System.Drawing.Size(65, 25);
			this._Label2_7.TabIndex = 34;
			this._Label2_7.Text = "User:";
			this._Label2_7.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_6
			// 
			this._Label2_6.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_6.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_6.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_6.Location = new System.Drawing.Point(44, 203);
			this._Label2_6.Name = "_Label2_6";
			this._Label2_6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_6.Size = new System.Drawing.Size(65, 25);
			this._Label2_6.TabIndex = 33;
			this._Label2_6.Text = "Password:";
			this._Label2_6.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_5
			// 
			this._Label2_5.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_5.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_5.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_5.Location = new System.Drawing.Point(44, 171);
			this._Label2_5.Name = "_Label2_5";
			this._Label2_5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_5.Size = new System.Drawing.Size(65, 25);
			this._Label2_5.TabIndex = 32;
			this._Label2_5.Text = "Language:";
			this._Label2_5.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_4
			// 
			this._Label2_4.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_4.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_4.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_4.Location = new System.Drawing.Point(44, 139);
			this._Label2_4.Name = "_Label2_4";
			this._Label2_4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_4.Size = new System.Drawing.Size(65, 25);
			this._Label2_4.TabIndex = 31;
			this._Label2_4.Text = "Host:";
			this._Label2_4.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_3
			// 
			this._Label2_3.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_3.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_3.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_3.Location = new System.Drawing.Point(44, 107);
			this._Label2_3.Name = "_Label2_3";
			this._Label2_3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_3.Size = new System.Drawing.Size(65, 25);
			this._Label2_3.TabIndex = 30;
			this._Label2_3.Text = "Cwd:";
			this._Label2_3.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_2
			// 
			this._Label2_2.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_2.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_2.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_2.Location = new System.Drawing.Point(44, 75);
			this._Label2_2.Name = "_Label2_2";
			this._Label2_2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_2.Size = new System.Drawing.Size(65, 25);
			this._Label2_2.TabIndex = 29;
			this._Label2_2.Text = "Charset:";
			this._Label2_2.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_1
			// 
			this._Label2_1.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_1.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_1.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_1.Location = new System.Drawing.Point(44, 43);
			this._Label2_1.Name = "_Label2_1";
			this._Label2_1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_1.Size = new System.Drawing.Size(65, 25);
			this._Label2_1.TabIndex = 28;
			this._Label2_1.Text = "Client:";
			this._Label2_1.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// _Label2_0
			// 
			this._Label2_0.BackColor = System.Drawing.SystemColors.Control;
			this._Label2_0.Cursor = System.Windows.Forms.Cursors.Default;
			this._Label2_0.ForeColor = System.Drawing.SystemColors.ControlText;
			this._Label2_0.Location = new System.Drawing.Point(44, 11);
			this._Label2_0.Name = "_Label2_0";
			this._Label2_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this._Label2_0.Size = new System.Drawing.Size(65, 25);
			this._Label2_0.TabIndex = 20;
			this._Label2_0.Text = "Port:";
			this._Label2_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// EnvForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(448, 318);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.cmdUpdate,
																		  this.txtUser,
																		  this.txtPassword,
																		  this.txtLanguage,
																		  this.txtHost,
																		  this.txtCwd,
																		  this.txtCharset,
																		  this.txtClient,
																		  this.txtPort,
																		  this.cmdClose,
																		  this._Label2_7,
																		  this._Label2_6,
																		  this._Label2_5,
																		  this._Label2_4,
																		  this._Label2_3,
																		  this._Label2_2,
																		  this._Label2_1,
																		  this._Label2_0});
			this.Name = "EnvForm";
			this.Text = "EnvForm";
			this.ResumeLayout(false);

		}
		#endregion

		private P4COM.p4 m_p4;

		public void DoEnv(P4COM.p4 p4)
		{
			m_p4 = p4;
			txtCharset.Text = m_p4.Charset;
			txtClient.Text = m_p4.Client;
			txtCwd.Text = m_p4.Cwd;
			txtHost.Text = m_p4.Host;
			txtLanguage.Text = m_p4.Language;
			txtPassword.Text = m_p4.Password;
			txtPort.Text = m_p4.Port;
			txtUser.Text = m_p4.User;
			
			ShowDialog();

		}

		private void cmdUpdate_Click(object sender, System.EventArgs e)
		{
			m_p4.Charset = txtCharset.Text;
			m_p4.Client = txtClient.Text;
			m_p4.Cwd = txtCwd.Text;
			m_p4.Host = txtHost.Text;
			m_p4.Language = txtLanguage.Text;
			m_p4.Password = txtPassword.Text;
			m_p4.Port = txtPort.Text;
			m_p4.User = txtUser.Text;
			Close();
		}

		private void cmdClose_Click(object sender, System.EventArgs e)
		{
			Close();
		}
	}
}
